from time import sleep

from appium.webdriver.common.appiumby import AppiumBy

from base.base_assert import current_page
from base.base_page import BasePage


class PageShopping(BasePage):

    def buy_now(self):
        pass

    def add_cart(self):
        """添加购物车"""
        locator_add_cart = "new UiSelector().className(\"android.view.View\").instance(3)"
        self._click(locator_add_cart)
        return self


    def collect(self):
        pass

    def goto_shopping_cart(self):
        """
        去购物车
        :return: 购物车页面
        """
        locator_shopping_cart = (AppiumBy.XPATH, "//android.widget.TextView[@text=\"购物车\"]")
        self._click(locator_shopping_cart)
        return current_page()



# if __name__ == '__main__':
#     from page.page_main import MainPage
#     page_main = MainPage()
#     page_main.goto_new_arrivals().new_arrivals_calendar_goto_shopping_cart().add_cart().goto_shopping_cart()
#
